home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Scope / Scope Disk #157 (199x)(Scope PD)(US)[WB].zip / Scope Disk #157 (199x)(Scope PD)(US)[WB].adf / JoyLib / joy0.asm < prev    next >
Assembly Source File  |  1990-10-25  |  1KB  |  68 lines

  1. *
  2. * JOY.asm
  3. *
  4. * subroutine for checking Amiga's gameports
  5. * this source for a68k
  6. *
  7. * by Oliver Wagner, Landsberge 5, 4322 Sprockhövel, West Germany
  8. *
  9. * This is Public Domain, Enjoy!
  10. *
  11. * remember:
  12. *   JOY_LEFT    = 1
  13. *   JOY_RIGHT    = 2
  14. *   JOY_UP    = 4
  15. *   JOY_DOWN    = 8
  16. *   JOY_FIRE    = 16
  17. *
  18. *
  19.  
  20.     CODE
  21.     xdef    _joy0
  22.     xdef    @joy0   ; Lettuce compatibility
  23.     xdef    _joy1
  24.     xdef    @joy1   ; Lettuce compatibility
  25.  
  26. _joy0:
  27. @joy0:
  28.     sub.l   a1,a1
  29.     move.w  $dff00a,d1
  30.     btst    #6,$bfe001
  31.     bne.s   dojoy
  32.     subq.w  #1,a1
  33.     bra.s   dojoy
  34.  
  35. _joy1:
  36. @joy1:
  37.     sub.l   a1,a1
  38.     move.w  $dff00c,d1
  39.     btst    #7,$bfe001
  40.     bne.s   dojoy
  41.     subq.w  #1,a1
  42.  
  43. dojoy:
  44.     and.w   #$303,d1
  45.     lea     jtab(pc),a0
  46.     moveq   #8,d0
  47. *
  48. * this algorith??? (<- shit :-) should give
  49. * best results on 68o1o or higher, but will
  50. * still suffice on the standard 68ooo
  51. *
  52. jlop:
  53.     cmp.w   (a0)+,d1
  54.     dbeq    d0,jlop
  55.     move.w  16(a0),d0
  56.     ext.l   d0
  57.     move.w  a1,d1
  58.     beq.s   return
  59.     or.w    #16,d0
  60. return:
  61.     rts
  62.  
  63. jtab:
  64.     dc.w    0,$3,$300,$100,$1,$103,$2,$200,$301
  65.     dc.w    0,2,1,4,8,6,10,5,9
  66.  
  67.     END
  68.